package cn.mg.framework.dto;

import com.github.pagehelper.PageHelper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * @author hezhaoming
 * @date 27-04-2020
 */
@Data
@ApiModel(value = "查询参数")
public class PageQuery implements Serializable {

    private static final long serialVersionUID = 3319698607712846427L;

    @ApiModelProperty(value = "主键")
    private Long id;

    @ApiModelProperty(value = "pageHelper 起始页", required = true)
    private Integer pageIndex;

    @ApiModelProperty(value = "pageHelper 每页的条数", required = true)
    private Integer pageSize;

    /**
     * pageHelper + easyUI
     *
     * @param
     * @return
     * @author 何兆明
     * @date 2018/8/16 上午11:19
     */
    public void startPage() {
        PageHelper.startPage(this.pageIndex == null ? 1 : this.pageIndex, this.pageSize == null ? 10 : this.pageSize);
    }

}
